package com.gitee.cirnochat.login.model.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.gitee.cirnochat.common.model.enums.BaseEnum;
import lombok.Getter;

/**
 * 二维码类型枚举
 * 用于标识不同类型的二维码，例如登录二维码等
 * @author FlanChan
 * @since 2025-05-29 15:31:33
 */
@Getter
public enum QrCodeType implements BaseEnum<Integer> {
    LOGIN(0, "登录二维码"),
    ;

    @EnumValue
    @JsonValue
    private final Integer value;
    private final String description;

    QrCodeType(Integer value, String description) {
        this.value = value;
        this.description = description;
    }

    public static QrCodeType fromValue(Integer value) {
        for (QrCodeType type : QrCodeType.values()) {
            if (type.getValue().equals(value)) {
                return type;
            }
        }
        return null;
    }
}
